package com.demo.page9101.feign.news;

import com.demo.common.entity.News;
import com.demo.page9101.feign.impl.news.NewsFeignImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
/**
 * 新闻动态
 * 作者：张佑威
 * 补充：孙佳佳
 */
@FeignClient(name = "houpu-service-bean",fallback = NewsFeignImpl.class)
public interface NewsFeign {

    /**
     * 分页搜索
     * @param pagenum
     * @return
     */
    @GetMapping("/News")
    public List<News> search(@RequestParam(value = "pagenum") Integer pagenum);

    /**
     * 通过ID查询新闻详情
     * @param NewId
     * @return
     */
    @GetMapping("/News/{NewId}")
    public News selectById(@PathVariable("NewId") Integer NewId);


    /**
     * 查询新闻及分页
     * @param id
     * @return
     */
    @GetMapping("/News/getnews")
    List<News> newsproduct(@RequestParam(value = "id", required = true) Integer id,
                           @RequestParam(value = "pagenum", required = false, defaultValue = "1") Integer pagenum);

}
